
* Daniel Berliner & Joachim Wehner
* "Audits for Accountability: Evidence from Municipal By-elections in South Africa"
* The Journal of Politics
* Stata replication do file
* Use together with Berliner-Wehner_main.dta
* Stata version 16.1
* Date prepared: May 14, 2021


tab province, gen(p)
tab muniname, gen(m)
tab date1, gen(d)
tab district, gen(dis)
tab year_dec, gen(y)


***************************************************
*** Table 1: Audits and by-election vote shares ***
***************************************************

set more off

* Direct effects only
reg vote_party_relevant c.outcome_change i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_1.out, nolabel bdec(3) rdec(3) replace

* Interactions
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_1.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_1.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_1.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

* Improvements and deteriorations separately
reg vote_party_relevant i.worse_time##i.window90 i.better_time##i.window90/*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_1.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + 1.better_time#1.window90
lincom 1.window90 + 1.worse_time#1.window90


****************************************************
*** Table A6: Heckman selection-correction model ***
****************************************************

* Heckman ML
heckman vote_party_relevant c.outcome_change##i.window90 if death == 1 & govpartydidntrun == 0 & year>=2008, /*
*/ select(contested = party_largest_seatshare c.outcome_change##i.window90) first vce(cluster date1)
*outreg2 using table_A6.out, nolabel bdec(3) rdec(3) replace

* Note: The equivalent with model 4 from Table 1 does not converge and with model 3 our selection variable is not significant (which yields inconsistent estimates).


****************************************
*** Table A7: Different time windows ***
****************************************

set more off

* 30 days
reg vote_party_relevant c.outcome_change##i.window30 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A7.out, nolabel bdec(3) rdec(3) replace
lincom 1.window30 + outcome_change#1.window30
lincom 1.window30 + (-1)*outcome_change#1.window30

* 60 days
reg vote_party_relevant c.outcome_change##i.window60 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A7.out, nolabel bdec(3) rdec(3) append
lincom 1.window60 + outcome_change#1.window60
lincom 1.window60 + (-1)*outcome_change#1.window60

* 90 days
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A7.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

* 120 days
reg vote_party_relevant c.outcome_change##i.window120 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A7.out, nolabel bdec(3) rdec(3) append
lincom 1.window120 + outcome_change#1.window120
lincom 1.window120 + (-1)*outcome_change#1.window120

* Continuous measure of time since last audit
* Based on a count of the number of days since the last audit release date.
* The day of the release has value zero. The highest observed value is 380.
* Observations before the first release date we use (10 July 2009) are missing.
* We use the log of the number of days (+1).
reg vote_party_relevant c.outcome_change##c.datefromlastauditrelease_log /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A7.out, nolabel bdec(3) rdec(3) append
lincom datefromlastauditrelease_log + outcome_change#c.datefromlastauditrelease_log
lincom datefromlastauditrelease_log + (-1)*outcome_change#c.datefromlastauditrelease_log


************************************************************************************
*** Table A8: Sample restricted to by-elections within 90 days of a release date ***
************************************************************************************

set more off

* Direct effects only
reg vote_party_relevant c.outcome_change i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & (window90 == 1 | windowbefore90 == 1), cluster(date1)
*outreg2 using table_A8.out, nolabel bdec(3) rdec(3) replace

* Interactions
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & (window90 == 1 | windowbefore90 == 1), cluster(date1)
*outreg2 using table_A8.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & (window90 == 1 | windowbefore90 == 1), cluster(date1)
*outreg2 using table_A8.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & (window90 == 1 | windowbefore90 == 1), cluster(date1)
*outreg2 using table_A8.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

* Improvements and deteriorations separately
reg vote_party_relevant i.worse_time##i.window90 i.better_time##i.window90/*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & (window90 == 1 | windowbefore90 == 1), cluster(date1)
*outreg2 using table_A8.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + 1.better_time#1.window90
lincom 1.window90 + 1.worse_time#1.window90


*********************************************
*** Table A9: Alternative standard errors ***
*********************************************

set more off

* Clustered two-way on date and municipality
gen interaction = outcome_change*window90
ivreg210 vote_party_relevant outcome_change window90 interaction /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1 muniname)
*outreg2 using table_A9.out, nolabel bdec(3) rdec(3) replace

* Ordinary SEs (not clustered on date)
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0
*outreg2 using table_A9.out, nolabel bdec(3) rdec(3) append

* Bootstrapped (not clustered on date)
bootstrap, reps(1000) seed(1): reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0
*outreg2 using table_A9.out, nolabel bdec(3) rdec(3) append

* Bootstrapped plus clustered on date
bootstrap, reps(1000) seed(1): reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A9.out, nolabel bdec(3) rdec(3) append


****************************************************************
*** Table A10: Excluding by-elections in individual provinces ***
****************************************************************

set more off

* Excluding Eastern Cape
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "EASTERN CAPE", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) replace

* Excluding Free State
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "FREE STATE", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding Gauteng
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "GAUTENG", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding KwaZulu-Natal
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "KWAZULU-NATAL", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding Limpopo
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "LIMPOPO", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding Mpumalanga
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "MPUMALANGA", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding North West
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "NORTH WEST", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding Northern Cape
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "NORTHERN CAPE", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append

* Excluding Western Cape
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & province ~= "WESTERN CAPE", cluster(date1)
*outreg2 using table_A10.out, nolabel bdec(3) rdec(3) append


*************************************************************
*** Table A11: Excluding by-elections in individual years ***
*************************************************************

set more off

* Excluding 2008
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2008, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) replace

* Excluding 2009
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2009, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append

* Excluding 2010
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2010, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append

* Excluding 2011
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2011, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append

* Excluding 2012
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2012, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append

* Excluding 2013
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2013, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append

* Excluding 2014
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2014, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append

* Excluding 2015
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ & year ~= 2015, cluster(date1)
*outreg2 using table_A11.out, nolabel bdec(3) rdec(3) append


**************************************
*** Table A12: Additional controls ***
**************************************

set more off

* Previous year audit outcome dummies
reg vote_party_relevant c.outcome_change##i.window90 i.outcome_prevyear /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A12.out, nolabel bdec(3) rdec(3) replace

* District dummies instead of province dummies
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant dis1-dis53 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A12.out, nolabel bdec(3) rdec(3) append

* Month of year dummies
reg vote_party_relevant c.outcome_change##i.window90 i.month /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A12.out, nolabel bdec(3) rdec(3) append

* Average HH income (log), population (log), linguistic fractionalization, % of HH with radio, %  of population with matric or higher education
reg vote_party_relevant c.outcome_change##i.window90 logincome logpop lingfrac tech_radio2011 edu_matric_higher2011 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A12.out, nolabel bdec(3) rdec(3) append

* Days since last regular election
reg vote_party_relevant c.outcome_change##i.window90 datefromlastregularelec /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A12.out, nolabel bdec(3) rdec(3) append


************************************************
*** Table A13: Inverse probability weighting ***
************************************************

set more off

reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 [pweight=ipw_vars], cluster(date1)
*outreg2 using table_A13.out, nolabel bdec(3) rdec(3) replace
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 [pweight=ipw_intfe], cluster(date1)
*outreg2 using table_A13.out, nolabel bdec(3) rdec(3) append
reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 [pweight=ipw_intfe_vars], cluster(date1)
*outreg2 using table_A13.out, nolabel bdec(3) rdec(3) append


*************************************
*** Table A14: Context conditions ***
*************************************

set more off

* Barriers to attribution
reg vote_party_relevant c.outcome_change##i.window90##i.barriers /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) replace

* Competition (number of seats difference)
reg vote_party_relevant c.outcome_change##i.window90##i.competitive /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* ANC majority party
reg vote_party_relevant c.outcome_change##i.window90##i.majparty_anc /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* Local media (at least 1)
reg vote_party_relevant c.outcome_change##i.window90##i.localmedia /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* HHs with radio
reg vote_party_relevant c.outcome_change##i.window90##c.tech_radio2011 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* HHs with internet
reg vote_party_relevant c.outcome_change##i.window90##c.tech_internet2011 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* HHs with TV
reg vote_party_relevant c.outcome_change##i.window90##c.tech_tv2011 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* Chiefs
reg vote_party_relevant c.outcome_change##i.window90##i.chiefs_muni_any /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* Rural municipality (category B4)
reg vote_party_relevant c.outcome_change##i.window90##i.rural /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append

* Linguistic fractionalization
reg vote_party_relevant c.outcome_change##i.window90##c.lingfrac /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0 /*
*/ , cluster(date1)
*outreg2 using table_A14.out, nolabel bdec(3) rdec(3) append


******************************************
*** Table A15: Audit outcome in levels ***
******************************************

set more off

* Direct effects only
reg vote_party_relevant c.audit_levels i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A15.out, nolabel bdec(3) rdec(3) replace

* Interactions
reg vote_party_relevant c.audit_levels##i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A15.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + audit_levels#1.window90
lincom 1.window90 + (-1)*audit_levels#1.window90

reg vote_party_relevant c.audit_levels##i.window90 /*
*/ localelec_vote_party_relevant if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A15.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + audit_levels#1.window90
lincom 1.window90 + (-1)*audit_levels#1.window90

reg vote_party_relevant c.audit_levels##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A15.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + audit_levels#1.window90
lincom 1.window90 + (-1)*audit_levels#1.window90

* Improvements and deteriorations separately
reg vote_party_relevant i.audit_good##i.window90 i.audit_bad##i.window90/*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A15.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + 1.audit_good#1.window90
lincom 1.window90 + 1.audit_bad#1.window90


************************************************
*** Table A16: Turnout as dependent variable ***
************************************************

set more off

* Direct effects only
reg turnoutpct c.outcome_change i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A16.out, nolabel bdec(3) rdec(3) replace

* Interactions
reg turnoutpct c.outcome_change##i.window90 /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A16.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

reg turnoutpct c.outcome_change##i.window90 /*
*/ localelec_turnoutpct if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A16.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

reg turnoutpct c.outcome_change##i.window90 /*
*/ localelec_turnoutpct p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A16.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

* Improvements and deteriorations separately
reg turnoutpct i.worse_time##i.window90 i.better_time##i.window90/*
*/ localelec_turnoutpct p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
*outreg2 using table_A16.out, nolabel bdec(3) rdec(3) append
lincom 1.window90 + 1.better_time#1.window90
lincom 1.window90 + 1.worse_time#1.window90


*********************************************************
*** Table A21: Summary statistics (by-elections data) ***
*********************************************************

sum /*
*/ majparty_anc /*
*/ barriers /*
*/ audit_bad /*
*/ better_time /*
*/ chiefs_muni_any /*
*/ competitive /*
*/ datefromlastregularelec /*
*/ datefromlastauditrelease_log /*
*/ audit_good /*
*/ tech_internet2011 /*
*/ tech_radio2011 /*
*/ tech_tv2011 /*
*/ localelec_turnoutpct /*
*/ localelec_vote_party_relevant /*
*/ lingfrac /*
*/ localmedia /*
*/ outcome_change /*
*/ audit_levels /*
*/ rural /*
*/ turnoutpct /*
*/ vote_party_relevant /*
*/ window120 /*
*/ window30 /*
*/ window60 /*
*/ window90 /*
*/ worse_time /*
*/ if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0

* The following statistics are reported for the wider sample used in Table A6.
sum /*
*/ party_largest_seatshare /*
*/ contested /*
*/ if death == 1 & govpartydidntrun == 0 & year>=2008


***************************************************
*** Figure A9: Graph of main regression results ***
***************************************************

set more off

reg vote_party_relevant c.outcome_change##i.window90 /*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
lincom 1.window90 + outcome_change#1.window90
lincom 1.window90 + (-1)*outcome_change#1.window90

nlcom (Deterioration: _b[1.window90] - _b[outcome_change#1.window90]) ///
      (Stagnation: _b[1.window90]) ///
      (Improvement: _b[1.window90] + _b[outcome_change#1.window90]) ///
      , post
est sto nlcom1
coefplot nlcom1, xline(0, lcolor(gs7) lwidth(thin)) xlabel(-.2 -.1 0 .1, labsize(3.5)) ///
      ylabel(1 "Deterioration" 2 "Stagnation" 3 "Improvement", labsize(3.5)) ///
      level(90)nolabel graphregion(color(white)) ///
	  xtitle("(a) Trichotomous Measure", size(3.5) height(3.5) color(black)) ///
	  dsize(medsmall) color(blue) ciopts(recast(rcap) color(blue)) name(figure_A9a, replace)


reg vote_party_relevant i.worse_time##i.window90 i.better_time##i.window90/*
*/ localelec_vote_party_relevant p1-p9 y1-y10 if death == 1 & uncontested ~= 1 & vote_party_relevant ~= 0, cluster(date1)
lincom 1.window90 + 1.better_time#1.window90
lincom 1.window90 + 1.worse_time#1.window90

nlcom (Deterioration: _b[1.window90] + _b[1.worse_time#1.window90]) ///
      (Stagnation: _b[1.window90]) ///
      (Improvement: _b[1.window90] + _b[1.better_time#1.window90]) ///
      , post
est sto nlcom2
coefplot nlcom2, xline(0, lcolor(gs7) lwidth(thin)) xlabel(-.2 -.1 0 .1, labsize(3.5)) ///
      ylabel(1 "Deterioration" 2 "Stagnation" 3 "Improvement", labsize(3.5)) ///
      level(90)nolabel graphregion(color(white))  ///
	  xtitle("(b) Separate Indicators", size(3.5) height(3.5) color(black)) ///
	  dsize(medsmall) color(red) ciopts(recast(rcap) color(red)) name(figure_A9b, replace)


graph combine figure_A9a figure_A9b, fysize(60) note("                       Marginal Effect of Audit Information on the Relevant Party's Vote Share", size(2.75) position(6) ring(30)) scale(1.15) graphregion(color(white)) name(figure_A9, replace)
*graph export figure_A9.eps, name(figure_A9) replace
